package processing.test.mechaapp;

import processing.core.PImage;
//game;

public class Nitrogen extends Atom {
		
	//Calling PImage from processing to create Nitrogen image
	private static PImage imageIcon;
	
	//Constructor for Nitrogen class, setting the position of the nitrogen atom
	//Also setting the properties of nitrogen.
	public Nitrogen(float x, float y, int i, int j){
		xChord = x;//x chord position on grid
		yChord = y;//y chord position on grid
		ith = i;//row position on grid
		jth = j;//column position on grid
		maxBonds = 3;//max number of links nitrogen can make
		numBonds = 0;//current number of bonds
		highlight = false;
		isVisited = false;
		molecule = new Molecule(this);
		bonds = new Atom[maxBonds];
		doublebonds = new Atom[maxBonds/2];//Nitrogen is one of atoms that can double bond.
		
		//total score when a carbon molecule is complete
		points = 350;
	}
		
	public void drawMe(){
		applet.stroke(255);//highlight color: white
		
		// if nitrogen is selected then highlight the atom
		if(highlight){
			applet.fill(0,100,255);
			applet.ellipse(xChord, yChord, size+10, size+10);
		}
		
		
		applet.imageMode(applet.CENTER);
		applet.image(this.imageIcon, xChord, yChord);
		applet.imageMode(applet.CORNER);
		
		/*
		applet.noStroke();
		applet.fill(200);
		if(numBonds == 1){
			applet.ellipse(xChord-3, yChord+13, 17, 17);
		}
		else if(numBonds == 2){
			applet.ellipse(xChord, yChord+13, 17, 17);
			applet.ellipse(xChord+11, yChord-11, 17, 17);
			
		}
		else if(numBonds == 3){
			applet.ellipse(xChord, yChord+13, 17, 17);
			applet.ellipse(xChord+11, yChord-11, 17, 17);
			applet.ellipse(xChord-10, yChord-11, 17, 17);
		}
		applet.stroke(255);*/
	}
	
	//method that sets the image for Nitrogen atom
	public static void setImage(PImage pic){
		imageIcon = pic;
	}
	
	
	//used for debugging.
	//Indicating the position of the selected nitrogen atom.
	public String toString(){
		return "Nitrogen; numBonds = "+numBonds+
				"\nith = "+ith+" jth = "+jth;
	}
}
